#!/usr/bin/env python
# -*- coding:utf-8 -*-
import urllib.request
import threading
import ssl
import os
from multiprocessing import Pool
import threading
from time import sleep,ctime

index = 0
urls=("https://segmentfault.com/a/1190000016683758",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",

      )
while index < 10000:
        ssl._create_default_https_context = ssl._create_unverified_context
        url = "https://segmentfault.com/a/1190000016683758"
        header = {
            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_0) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11"}
        request = urllib.request.Request(url, headers=header)
        reponse = urllib.request.urlopen(request).read()
        if str(reponse).find("人类")>0:
            print("出现了异常")
            break
        index += 1
        print("线程：%d，index%d"%(1,index))
        length = len(threading.enumerate())
        print('当前运行的线程数为：%d' % length)
        print(reponse)
        #sleep(10)
        #sleep(3)


